# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=libblockdev
pkgver=2.26
pkgrel=1
pkgdesc="Library for manipulating block devices"
url="https://github.com/storaged-project/libblockdev"
arch="all"
license="LGPL-2.1-or-later"
makedepends="
	python3
	cryptsetup-dev
	libbytesize-dev
	ndctl-dev
	lvm2-dev
	glib-dev
	kmod-dev
	parted-dev
	nss-dev
	yaml-dev
	coreutils
	eudev-dev
	dmraid-dev
	volume_key-dev
	bash
	gobject-introspection-dev
	"
subpackages="$pkgname-dev py3-$pkgname:_py3:noarch"
source="https://github.com/storaged-project/libblockdev/releases/download/$pkgver-1/libblockdev-$pkgver.tar.gz
	fix-glibc-glob-onlydir.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

_py3() {
	pkgdesc="$pkgdesc - python3-bindings"

	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/python3* "$subpkgdir"/usr/lib
}

sha512sums="
ddd4e9c22135bd7dad0bb9bc254ac0c63e3bacc592e7c5a0c846e367da3fc248bf6187f1c81407c3bce599d3b0ceeec9a8a0030ad8e981e245f715b35eaec523  libblockdev-2.26.tar.gz
199b184b2955a49320f2d8dd71be31507f170a21652c8dbc5d2821b5a451d8252402c4a14f8c0cef6b95c8a9ae85a6f385d5b9720d2d683b3b41fe1a056fc438  fix-glibc-glob-onlydir.patch
"
